import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import Vant, {Lazyload} from 'vant'
import 'vant/lib/index.css'
import '@/assets/style/border.css'
import '@/assets/style/reset.css'
import '@/assets/style/iconfont.css'
import '@/assets/model.scss'
import {postKeyValueRequest} from "./utils/api";
import {postRequest} from "./utils/api";
import {getRequest} from "./utils/api";
import {putRequest} from "./utils/api";
import {deleteRequest} from "./utils/api";

Vue.use(Vant);
Vue.use(Lazyload);

/**
 * CRUD全局配置
 */
Vue.prototype.postRequest = postRequest;
Vue.prototype.postKeyValueRequest = postKeyValueRequest;
Vue.prototype.putRequest = putRequest;
Vue.prototype.deleteRequest = deleteRequest;
Vue.prototype.getRequest = getRequest;

Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App),

  mounted(){
    let map = new BMap.Map('allmap');
    let myCity = new BMap.LocalCity();
    myCity.get((result) => {
      if (result) {
        this.$store.state.city = result.name
      } else {
        this.$store.state.city = '北京'
      }
    })
  }
}).$mount('#app')
